package com.lee.dutylower.domain;

/**
 * Created by lijie on 2017/5/16.
 */

public enum SquadTypeEnum {
    OnSquad("上岗班",111),DutySquad("值班班",222),RestSquad("补岗班",333);
    private String name;
    private int type;
    SquadTypeEnum(String name, int type) {
        this.name = name;
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }
    public static SquadTypeEnum getByType(int type){
        SquadTypeEnum result = null;
        switch (type){
            case 111:
                result = OnSquad;
                break;
            case 222:
                result = DutySquad;
                break;
            case 333:
                result = RestSquad;
                break;
        }
        return result;
    }

    public static SquadTypeEnum getByName(String name){
        SquadTypeEnum result = null;
        switch (name){
            case "上岗班":
                result = OnSquad;
                break;
            case "值班班":
                result = DutySquad;
                break;
            case "补岗班":
                result = RestSquad;
                break;
        }
        return result;
    }
}
